//    												
//    												
//    	 ______    ______    ______					
//    	/\  __ \  /\  ___\  /\  ___\			
//    	\ \  __<  \ \  __\_ \ \  __\_		
//    	 \ \_____\ \ \_____\ \ \_____\		
//    	  \/_____/  \/_____/  \/_____/			
//    												
//    												
//    												
// title:  Ding
// author: Ding
// date:   2014-11-24 09:56:57 +0000
//

#import "dingding.h"

#pragma mark - IMAGEMODEL

@implementation IMAGEMODEL

@synthesize largeimg = _largeimg;
@synthesize smallimg = _smallimg;

- (BOOL)validate
{
    return YES;
}

@end

#pragma mark - PERSONALPETMODEL

@implementation PERSONALPETMODEL

@synthesize address = _address;
@synthesize birthday = _birthday;
@synthesize createtime = _createtime;
@synthesize gender = _gender;
@synthesize pet_id = _pet_id;
@synthesize petname = _petname;
@synthesize profile_url = _profile_url;
@synthesize signature = _signature;
@synthesize user_id = _user_id;
@synthesize variety = _variety;

- (BOOL)validate
{
    return YES;
}

@end

#pragma mark - SHAREITEMMODEL

@implementation SHAREITEMMODEL

@synthesize color = _color;
@synthesize create_time = _create_time;
@synthesize image = _image;
@synthesize is_deleted = _is_deleted;
@synthesize is_show = _is_show;
@synthesize item_id = _item_id;
@synthesize item_type = _item_type;
@synthesize keyword = _keyword;
@synthesize price = _price;
@synthesize summary = _summary;
@synthesize title = _title;
@synthesize total_images = _total_images;
@synthesize user_nickname = _user_nickname;

CONVERT_PROPERTY_CLASS( image, IMAGEMODEL );

- (BOOL)validate
{
    return YES;
}

@end

#pragma mark - THIRDLOGINUSERMODEL

@implementation THIRDLOGINUSERMODEL

@synthesize bio = _bio;
@synthesize city = _city;
@synthesize create_time = _create_time;
@synthesize gender = _gender;
@synthesize has_store = _has_store;
@synthesize im_password = _im_password;
@synthesize im_username = _im_username;
@synthesize is_deleted = _is_deleted;
@synthesize is_social = _is_social;
@synthesize is_star = _is_star;
@synthesize location = _location;
@synthesize nickname = _nickname;
@synthesize petInfo = _petInfo;
@synthesize province = _province;
@synthesize token = _token;
@synthesize total_album = _total_album;
@synthesize total_favorite_album = _total_favorite_album;
@synthesize total_favorite_share = _total_favorite_share;
@synthesize total_follow = _total_follow;
@synthesize total_follower = _total_follower;
@synthesize total_like = _total_like;
@synthesize total_share = _total_share;
@synthesize user_id = _user_id;

CONVERT_PROPERTY_CLASS( petInfo, LOGINPETINFOMODEL );

- (BOOL)validate
{
    return YES;
}

@end

@implementation loginModel


@end

#pragma mark - SHAREMAINMODEL

@implementation SHAREMAINMODEL

@synthesize IMusername = _IMusername;
@synthesize create_time = _create_time;
@synthesize email = _email;
@synthesize follows = _follows;
@synthesize funs = _funs;
@synthesize has_store = _has_store;
@synthesize is_social = _is_social;
@synthesize is_star = _is_star;
@synthesize item = _item;
@synthesize last_login_time = _last_login_time;
@synthesize nickname = _nickname;
@synthesize petInfo = _petInfo;
@synthesize relation = _relation;
@synthesize total_album = _total_album;
@synthesize total_favorite_album = _total_favorite_album;
@synthesize total_favorite_share = _total_favorite_share;
@synthesize total_follow = _total_follow;
@synthesize total_follower = _total_follower;
@synthesize total_like = _total_like;
@synthesize total_share = _total_share;
@synthesize user_id = _user_id;

CONVERT_PROPERTY_CLASS( item, SHAREITEMMODEL );

- (BOOL)validate
{
    return YES;
}

@end

#pragma mark - NEARBYMODEL

@implementation NEARBYMODEL

@synthesize address = _address;
@synthesize birthday = _birthday;
@synthesize createtime = _createtime;
@synthesize distance = _distance;
@synthesize gender = _gender;
@synthesize imgurl = _imgurl;
@synthesize is_head = _is_head;
@synthesize lat = _lat;
@synthesize lng = _lng;
@synthesize pet_id = _pet_id;
@synthesize petname = _petname;
@synthesize pic_id = _pic_id;
@synthesize signature = _signature;
@synthesize upload_time = _upload_time;
@synthesize user_id = _user_id;
@synthesize variety = _variety;
@synthesize IMusername = _IMusername;

- (BOOL)validate
{
    return YES;
}

@end

#pragma mark - PETINFOMODEL

@implementation PETINFOMODEL

@synthesize address = _address;
@synthesize avatar = _avatar;
@synthesize birthday = _birthday;
@synthesize createtime = _createtime;
@synthesize gender = _gender;
@synthesize pet_id = _pet_id;
@synthesize petname = _petname;
@synthesize signature = _signature;
@synthesize user_id = _user_id;
@synthesize variety = _variety;

- (BOOL)validate
{
    return YES;
}

@end

@implementation LOGINPETINFOMODEL

@synthesize address = _address;
@synthesize avatar = _avatar;
@synthesize birthday = _birthday;
@synthesize createtime = _createtime;
@synthesize gender = _gender;
@synthesize pet_id = _pet_id;
@synthesize petname = _petname;
@synthesize signature = _signature;
@synthesize user_id = _user_id;
@synthesize variety = _variety;
@synthesize imgurl = _imgurl;
- (BOOL)validate
{
    return YES;
}


@end

#pragma mark - USERMODEL

@implementation USERMODEL

@synthesize create_time = _create_time;
@synthesize email = _email;
@synthesize im_password = _im_password;
@synthesize im_username = _im_username;
@synthesize lat = _lat;
@synthesize lng = _lng;
@synthesize nickname = _nickname;
@synthesize pet_info = _pet_info;
@synthesize token = _token;
@synthesize user_id = _user_id;

CONVERT_PROPERTY_CLASS( pet_info, PETINFOMODEL );

- (BOOL)validate
{
    return YES;
}

@end

#pragma mark - PETLIST

@implementation PETLIST

@synthesize cat = _cat;
@synthesize dog = _dog;
@synthesize other = _other;

CONVERT_PROPERTY_CLASS( cat, PETMODEL );
CONVERT_PROPERTY_CLASS( dog, PETMODEL );
CONVERT_PROPERTY_CLASS( other, PETMODEL );

- (BOOL)validate
{
	return YES;
}

@end

#pragma mark - PETMODEL

@implementation PETMODEL

@synthesize id_ = _id_;
@synthesize index = _index;
@synthesize name = _name;
@synthesize pid = _pid;

- (BOOL)validate
{
	return YES;
}

@end

#pragma mark - GET dingding_get_addpet

#pragma mark - REQ_DINGDING_GET_ADDPET

@implementation REQ_DINGDING_GET_ADDPET

@synthesize address = _address;
@synthesize age = _age;
@synthesize gender = _gender;
@synthesize lat = _lat;
@synthesize lng = _lng;
@synthesize pet_id = _pet_id;
@synthesize petname = _petname;
@synthesize signature = _signature;
@synthesize token = _token;
@synthesize user_id = _user_id;
@synthesize variety = _variety;

- (BOOL)validate
{
	return YES;
}

@end

#pragma mark - RESP_DINGDING_GET_ADDPET

@implementation RESP_DINGDING_GET_ADDPET

@synthesize code = _code;
@synthesize msg = _msg;

- (BOOL)validate
{
	return YES;
}

@end

@implementation API_DINGDING_GET_ADDPET

@synthesize req = _req;
@synthesize resp = _resp;

- (id)init
{
	self = [super init];
	if ( self )
	{
		self.req = [[[REQ_DINGDING_GET_ADDPET alloc] init] autorelease];
		self.resp = nil;
	}
	return self;
}

- (void)dealloc
{
	self.req = nil;
	self.resp = nil;
	[super dealloc];
}

- (void)routine
{
	if ( self.sending )
	{
		if ( nil == self.req || NO == [self.req validate] )
		{
			self.failed = YES;
			return;
		}

		NSString * requestURI = [[ServerConfig sharedInstance].url stringByAppendingString:@"/pet/addPet"];
		self.HTTP_GET( requestURI ).PARAM( [self.req objectToDictionary] );
	}
	else if ( self.succeed )
	{
		NSObject * result = self.responseJSON;

		if ( result && [result isKindOfClass:[NSDictionary class]] )
		{
			self.resp = [RESP_DINGDING_GET_ADDPET objectFromDictionary:(NSDictionary *)result];
		}

		if ( nil == self.resp || NO == [self.resp validate] )
		{
			self.failed = YES;
			return;
		}
	}
	else if ( self.failed )
	{
		// TODO:
	}
	else if ( self.cancelled )
	{
		// TODO:
	}
}
@end

#pragma mark - GET dingding_get_NearByUser

#pragma mark - REQ_DINGDING_GET_NEARBYUSER

@implementation REQ_DINGDING_GET_NEARBYUSER

@synthesize lat = _lat;
@synthesize lng = _lng;
@synthesize page = _page;
@synthesize pagesize = _pagesize;
@synthesize token = _token;
@synthesize user_id = _user_id;

- (BOOL)validate
{
    return YES;
}

@end

#pragma mark - RESP_DINGDING_GET_NEARBYUSER

@implementation RESP_DINGDING_GET_NEARBYUSER

@synthesize code = _code;
@synthesize data = _data;
@synthesize msg = _msg;

CONVERT_PROPERTY_CLASS( data, NEARBYMODEL );

- (BOOL)validate
{
    return YES;
}

@end

@implementation API_DINGDING_GET_NEARBYUSER

@synthesize req = _req;
@synthesize resp = _resp;

- (id)init
{
    self = [super init];
    if ( self )
    {
        self.req = [[[REQ_DINGDING_GET_NEARBYUSER alloc] init] autorelease];
        self.resp = nil;
    }
    return self;
}

- (void)dealloc
{
    self.req = nil;
    self.resp = nil;
    [super dealloc];
}

- (void)routine
{
    if ( self.sending )
    {
        if ( nil == self.req || NO == [self.req validate] )
        {
            self.failed = YES;
            return;
        }
        
        NSString * requestURI = [[ServerConfig sharedInstance].url stringByAppendingString:@"/pet/getNearbyUser"];
        self.HTTP_GET( requestURI ).PARAM( [self.req objectToDictionary] );
    }
    else if ( self.succeed )
    {
        NSObject * result = self.responseJSON;
        
        if ( result && [result isKindOfClass:[NSDictionary class]] )
        {
            self.resp = [RESP_DINGDING_GET_NEARBYUSER objectFromDictionary:(NSDictionary *)result];
        }
        
        if ( nil == self.resp || NO == [self.resp validate] )
        {
            self.failed = YES;
            return;
        }
    }
    else if ( self.failed )
    {
        // TODO:
    }
    else if ( self.cancelled )
    {
        // TODO:
    }
}
@end


#pragma mark - GET dingding_get_petlist

#pragma mark - REQ_DINGDING_GET_PETLIST

@implementation REQ_DINGDING_GET_PETLIST

@synthesize phone = _phone;

- (BOOL)validate
{
	return YES;
}

@end

#pragma mark - GET dingding_LOGIN

#pragma mark - REQ_DINGDING_LOGIN

@implementation REQ_DINGDING_LOGIN

@synthesize access_token = _access_token;
@synthesize baidu_id = _baidu_id;
@synthesize device_id = _device_id;
@synthesize device_type = _device_type;
@synthesize expires_in = _expires_in;
@synthesize format = _format;
@synthesize nickname = _nickname;
@synthesize openid = _openid;
@synthesize timestamp = _timestamp;
@synthesize vendor = _vendor;

- (BOOL)validate
{
    return YES;
}

@end

#pragma mark - RESP_DINGDING_LOGIN

@implementation RESP_DINGDING_LOGIN

@synthesize code = _code;
@synthesize data = _data;
@synthesize msg = _msg;
@synthesize time = _time;
@synthesize vendor = _vendor;

- (BOOL)validate
{
    return YES;
}

@end

@implementation API_DINGDING_LOGIN

@synthesize req = _req;
@synthesize resp = _resp;

- (id)init
{
    self = [super init];
    if ( self )
    {
        self.req = [[[REQ_DINGDING_LOGIN alloc] init] autorelease];
        self.resp = nil;
    }
    return self;
}

- (void)dealloc
{
    self.req = nil;
    self.resp = nil;
    [super dealloc];
}

- (void)routine
{
    if ( self.sending )
    {
        if ( nil == self.req || NO == [self.req validate] )
        {
            self.failed = YES;
            return;
        }
        
        NSString * requestURI = [[ServerConfig sharedInstance].url stringByAppendingString:@"/social/login"];
        self.HTTP_GET( requestURI ).PARAM( [self.req objectToDictionary] );
    }
    else if ( self.succeed )
    {
        NSObject * result = self.responseJSON;
        
        if ( result && [result isKindOfClass:[NSDictionary class]] )
        {
            self.resp = [RESP_DINGDING_LOGIN objectFromDictionary:(NSDictionary *)result];
        }
        
        if ( nil == self.resp || NO == [self.resp validate] )
        {
            self.failed = YES;
            return;
        }
    }
    else if ( self.failed )
    {
        // TODO:
    }
    else if ( self.cancelled )
    {
        // TODO:
    }
}
@end

#pragma mark - RESP_DINGDING_GET_PETLIST

@implementation RESP_DINGDING_GET_PETLIST

@synthesize code = _code;
@synthesize data = _data;
@synthesize msg = _msg;

- (BOOL)validate
{
	return YES;
}

@end

@implementation API_DINGDING_GET_PETLIST

@synthesize req = _req;
@synthesize resp = _resp;

- (id)init
{
	self = [super init];
	if ( self )
	{
		self.req = [[[REQ_DINGDING_GET_PETLIST alloc] init] autorelease];
		self.resp = nil;
	}
	return self;
}

- (void)dealloc
{
	self.req = nil;
	self.resp = nil;
	[super dealloc];
}

- (void)routine
{
	if ( self.sending )
	{
		if ( nil == self.req || NO == [self.req validate] )
		{
			self.failed = YES;
			return;
		}

		NSString * requestURI = [[ServerConfig sharedInstance].url stringByAppendingString:@"/pet/getpetList"];
		self.HTTP_GET( requestURI ).PARAM( [self.req objectToDictionary] );
	}
	else if ( self.succeed )
	{
		NSObject * result = self.responseJSON;

		if ( result && [result isKindOfClass:[NSDictionary class]] )
		{
			self.resp = [RESP_DINGDING_GET_PETLIST objectFromDictionary:(NSDictionary *)result];
		}

		if ( nil == self.resp || NO == [self.resp validate] )
		{
			self.failed = YES;
			return;
		}
	}
	else if ( self.failed )
	{
		// TODO:
	}
	else if ( self.cancelled )
	{
		// TODO:
	}
    NSLog(@"%ld--%@---%ld",(long)self.state,self.errorDesc,(long)self.errorCode);
}
@end

#pragma mark - GET dingding_get_phoneLogin

#pragma mark - REQ_DINGDING_GET_PHONELOGIN

@implementation REQ_DINGDING_GET_PHONELOGIN

@synthesize password = _password;
@synthesize phone = _phone;

- (BOOL)validate
{
	return YES;
}

@end

#pragma mark - RESP_DINGDING_GET_PHONELOGIN

@implementation RESP_DINGDING_GET_PHONELOGIN

@synthesize code = _code;
@synthesize msg = _msg;
@synthesize data = _data;

- (BOOL)validate
{
	return YES;
}

@end

@implementation API_DINGDING_GET_PHONELOGIN

@synthesize req = _req;
@synthesize resp = _resp;

- (id)init
{
	self = [super init];
	if ( self )
	{
		self.req = [[[REQ_DINGDING_GET_PHONELOGIN alloc] init] autorelease];
		self.resp = nil;
	}
	return self;
}

- (void)dealloc
{
	self.req = nil;
	self.resp = nil;
	[super dealloc];
}

- (void)routine
{
	if ( self.sending )
	{
		if ( nil == self.req || NO == [self.req validate] )
		{
			self.failed = YES;
			return;
		}

		NSString * requestURI = [[ServerConfig sharedInstance].url stringByAppendingString:@"/pet/phoneLogin"];
		self.HTTP_GET( requestURI ).PARAM( [self.req objectToDictionary] );
	}
	else if ( self.succeed )
	{
		NSObject * result = self.responseJSON;

		if ( result && [result isKindOfClass:[NSDictionary class]] )
		{
			self.resp = [RESP_DINGDING_GET_PHONELOGIN objectFromDictionary:(NSDictionary *)result];
		}

		if ( nil == self.resp || NO == [self.resp validate] )
		{
			self.failed = YES;
			return;
		}
	}
	else if ( self.failed )
	{
		// TODO:
	}
	else if ( self.cancelled )
	{
		// TODO:
	}
}
@end

#pragma mark - GET dingding_get_phoneRegister

#pragma mark - REQ_DINGDING_GET_PHONEREGISTER

@implementation REQ_DINGDING_GET_PHONEREGISTER

@synthesize password = _password;
@synthesize phone = _phone;
@synthesize verifyCode = _verifyCode;

- (BOOL)validate
{
	return YES;
}

@end

#pragma mark - RESP_DINGDING_GET_PHONEREGISTER

@implementation RESP_DINGDING_GET_PHONEREGISTER

@synthesize code = _code;
@synthesize msg = _msg;
@synthesize data = _data;

- (BOOL)validate
{
	return YES;
}

@end

@implementation API_DINGDING_GET_PHONEREGISTER

@synthesize req = _req;
@synthesize resp = _resp;

- (id)init
{
	self = [super init];
	if ( self )
	{
		self.req = [[[REQ_DINGDING_GET_PHONEREGISTER alloc] init] autorelease];
		self.resp = nil;
	}
	return self;
}

- (void)dealloc
{
	self.req = nil;
	self.resp = nil;
	[super dealloc];
}

- (void)routine
{
	if ( self.sending )
	{
		if ( nil == self.req || NO == [self.req validate] )
		{
			self.failed = YES;
			return;
		}

		NSString * requestURI = [[ServerConfig sharedInstance].url stringByAppendingString:@"/pet/phoneRegister"];
		self.HTTP_GET( requestURI ).PARAM( [self.req objectToDictionary] );
	}
	else if ( self.succeed )
	{
		NSObject * result = self.responseJSON;

		if ( result && [result isKindOfClass:[NSDictionary class]] )
		{
			self.resp = [RESP_DINGDING_GET_PHONEREGISTER objectFromDictionary:(NSDictionary *)result];
		}

		if ( nil == self.resp || NO == [self.resp validate] )
		{
			self.failed = YES;
			return;
		}
	}
	else if ( self.failed )
	{
		// TODO:
	}
	else if ( self.cancelled )
	{
		// TODO:
	}
}
@end

#pragma mark - GET dingding_get_phoneVerifyCode

#pragma mark - RESP_DINGDING_GET_PHONEVERIFYCODE

@implementation REQ_DINGDING_GET_PHONEVERIFYCODE

@synthesize phone = _phone;

- (BOOL)validate
{
    return YES;
}

@end


@implementation RESP_DINGDING_GET_PHONEVERIFYCODE

@synthesize code = _code;
@synthesize msg = _msg;

- (BOOL)validate
{
	return YES;
}

@end

@implementation API_DINGDING_GET_PHONEVERIFYCODE

@synthesize resp = resp;
@synthesize req = req;

- (id)init
{
	self = [super init];
	if ( self )
	{
        self.req = [[[REQ_DINGDING_GET_PHONEVERIFYCODE alloc] init] autorelease];
		self.resp = nil;
	}
	return self;
}

- (void)dealloc
{
	self.resp = nil;
	[super dealloc];
}

- (void)routine
{
	if ( self.sending )
	{
		NSString * requestURI = [[ServerConfig sharedInstance].url stringByAppendingString:@"/pet/sendVerifyCode"];
        self.HTTP_GET( requestURI ).PARAM( [self.req objectToDictionary] );
	}
	else if ( self.succeed )
	{
		NSObject * result = self.responseJSON;

		if ( result && [result isKindOfClass:[NSDictionary class]] )
		{
			self.resp = [RESP_DINGDING_GET_PHONEVERIFYCODE objectFromDictionary:(NSDictionary *)result];
		}

		if ( nil == self.resp || NO == [self.resp validate] )
		{
			self.failed = YES;
			return;
		}
	}
	else if ( self.failed )
	{
		// TODO:
	}
	else if ( self.cancelled )
	{
		// TODO:
	}
}
@end

#pragma mark - POST dingding_post_add_pet_head

#pragma mark - REQ_DINGDING_POST_ADD_PET_HEAD

@implementation REQ_DINGDING_POST_ADD_PET_HEAD

@synthesize file1 = _file1;
@synthesize user_id = _user_id;

- (BOOL)validate
{
	return YES;
}

@end

#pragma mark - RESP_DINGDING_POST_ADD_PET_HEAD

@implementation RESP_DINGDING_POST_ADD_PET_HEAD

@synthesize code = _code;
@synthesize msg = _msg;

- (BOOL)validate
{
	return YES;
}

@end

@implementation API_DINGDING_POST_ADD_PET_HEAD

@synthesize req = _req;
@synthesize resp = _resp;

- (id)init
{
	self = [super init];
	if ( self )
	{
		self.req = [[[REQ_DINGDING_POST_ADD_PET_HEAD alloc] init] autorelease];
		self.resp = nil;
	}
	return self;
}

- (void)dealloc
{
	self.req = nil;
	self.resp = nil;
	[super dealloc];
}

- (void)routine
{
	if ( self.sending )
	{
		if ( nil == self.req || NO == [self.req validate] )
		{
			self.failed = YES;
			return;
		}

		NSString * requestURI = [[ServerConfig sharedInstance].url stringByAppendingString:@"/pet/add_pet_head"];

		self.HTTP_POST( requestURI ).PARAM( @"user_id", self.req.user_id).FILE_PNG_ALIAS(@"file1",self.req.file1,@"head.jpg");
	}
	else if ( self.succeed )
	{
		NSObject * result = self.responseJSON;

		if ( result && [result isKindOfClass:[NSDictionary class]] )
		{
			self.resp = [RESP_DINGDING_POST_ADD_PET_HEAD objectFromDictionary:(NSDictionary *)result];
		}

		if ( nil == self.resp || NO == [self.resp validate] )
		{
			self.failed = YES;
			return;
		}
	}
	else if ( self.failed )
	{
		// TODO:
	}
	else if ( self.cancelled )
	{
		// TODO:
	}
}
@end

#pragma mark - GET dingding_getPetNameByid

#pragma mark - REQ_DINGDING_GETPETNAMEBYID

@implementation REQ_DINGDING_GETPETNAMEBYID

@synthesize p_id = p_id;

- (BOOL)validate
{
    return YES;
}

@end


#pragma mark - GET dingding_get_changePetInfoer

#pragma mark - REQ_DINGDING_GET_CHANGEPETINFOER

@implementation REQ_DINGDING_GET_CHANGEPETINFOER

@synthesize address = _address;
@synthesize age = _age;
@synthesize gender = _gender;
@synthesize lat = _lat;
@synthesize lng = _lng;
@synthesize pet_id = _pet_id;
@synthesize petname = _petname;
@synthesize signature = _signature;
@synthesize token = _token;
@synthesize user_id = _user_id;
@synthesize variety = _variety;

- (BOOL)validate
{
    return YES;
}

@end

#pragma mark - RESP_DINGDING_GET_CHANGEPETINFOER

@implementation RESP_DINGDING_GET_CHANGEPETINFOER

@synthesize code = _code;
@synthesize msg = _msg;

- (BOOL)validate
{
    return YES;
}

@end

@implementation API_DINGDING_GET_CHANGEPETINFOER

@synthesize req = _req;
@synthesize resp = _resp;

- (id)init
{
    self = [super init];
    if ( self )
    {
        self.req = [[[REQ_DINGDING_GET_CHANGEPETINFOER alloc] init] autorelease];
        self.resp = nil;
    }
    return self;
}

- (void)dealloc
{
    self.req = nil;
    self.resp = nil;
    [super dealloc];
}

- (void)routine
{
    if ( self.sending )
    {
        if ( nil == self.req || NO == [self.req validate] )
        {
            self.failed = YES;
            return;
        }
        
        NSString * requestURI = [[ServerConfig sharedInstance].url stringByAppendingString:@"/pet/changePetInfo"];
        self.HTTP_GET( requestURI ).PARAM( [self.req objectToDictionary] );
    }
    else if ( self.succeed )
    {
        NSObject * result = self.responseJSON;
        
        if ( result && [result isKindOfClass:[NSDictionary class]] )
        {
            self.resp = [RESP_DINGDING_GET_CHANGEPETINFOER objectFromDictionary:(NSDictionary *)result];
        }
        
        if ( nil == self.resp || NO == [self.resp validate] )
        {
            self.failed = YES;
            return;
        }
    }
    else if ( self.failed )
    {
        // TODO:
    }
    else if ( self.cancelled )
    {
        // TODO:
    }
}
@end


#pragma mark - RESP_DINGDING_GETPETNAMEBYID

@implementation RESP_DINGDING_GETPETNAMEBYID

@synthesize code = _code;
@synthesize data = _data;
@synthesize msg = _msg;

- (BOOL)validate
{
    return YES;
}

@end

@implementation API_DINGDING_GETPETNAMEBYID

@synthesize req = _req;
@synthesize resp = _resp;

- (id)init
{
    self = [super init];
    if ( self )
    {
        self.req = [[[REQ_DINGDING_GETPETNAMEBYID alloc] init] autorelease];
        self.resp = nil;
    }
    return self;
}

- (void)dealloc
{
    self.req = nil;
    self.resp = nil;
    [super dealloc];
}

- (void)routine
{
    if ( self.sending )
    {
        if ( nil == self.req || NO == [self.req validate] )
        {
            self.failed = YES;
            return;
        }
        
        NSString * requestURI = [[ServerConfig sharedInstance].url stringByAppendingString:@"/pet/getPetNameByid"];
        self.HTTP_GET( requestURI ).PARAM( [self.req objectToDictionary] );
    }
    else if ( self.succeed )
    {
        NSObject * result = self.responseJSON;
        
        if ( result && [result isKindOfClass:[NSDictionary class]] )
        {
            self.resp = [RESP_DINGDING_GETPETNAMEBYID objectFromDictionary:(NSDictionary *)result];
        }
        
        if ( nil == self.resp || NO == [self.resp validate] )
        {
            self.failed = YES;
            return;
        }
    }
    else if ( self.failed )
    {
        // TODO:
    }
    else if ( self.cancelled )
    {
        // TODO:
    }
}
@end



#pragma mark - GET dingding_getUserInfo

#pragma mark - REQ_DINGDING_GETUSERINFO

@implementation REQ_DINGDING_GETUSERINFO

@synthesize fid = _fid;
@synthesize token = _token;
@synthesize user_id = _user_id;
@synthesize page = _page;
@synthesize pagesize = _pagesize;

- (BOOL)validate
{
    return YES;
}

@end

#pragma mark - RESP_DINGDING_GETUSERINFO

@implementation RESP_DINGDING_GETUSERINFO

@synthesize code = _code;
@synthesize data = _data;
@synthesize msg = _msg;

//CONVERT_PROPERTY_CLASS( data, NEARBYMODEL );

- (BOOL)validate
{
    return YES;
}

@end

@implementation API_DINGDING_GETUSERINFO

@synthesize req = _req;
@synthesize resp = _resp;

- (id)init
{
    self = [super init];
    if ( self )
    {
        self.req = [[[REQ_DINGDING_GETUSERINFO alloc] init] autorelease];
        self.resp = nil;
    }
    return self;
}

- (void)dealloc
{
    self.req = nil;
    self.resp = nil;
    [super dealloc];
}

- (void)routine
{
    if ( self.sending )
    {
        if ( nil == self.req || NO == [self.req validate] )
        {
            self.failed = YES;
            return;
        }
        
        NSString * requestURI = [[ServerConfig sharedInstance].url stringByAppendingString:@"/pet/getUserInfo"];
        self.HTTP_GET( requestURI ).PARAM( [self.req objectToDictionary] );
    }
    else if ( self.succeed )
    {
        NSObject * result = self.responseJSON;
        
        if ( result && [result isKindOfClass:[NSDictionary class]] )
        {
            self.resp = [RESP_DINGDING_GETUSERINFO objectFromDictionary:(NSDictionary *)result];
        }
        
        if ( nil == self.resp || NO == [self.resp validate] )
        {
            self.failed = YES;
            return;
        }
    }
    else if ( self.failed )
    {
        // TODO:
    }
    else if ( self.cancelled )
    {
        // TODO:
    }
}
@end


#pragma mark - config

@implementation ServerConfig

DEF_SINGLETON( ServerConfig )

DEF_INT( CONFIG_DEVELOPMENT,	0 )
DEF_INT( CONFIG_TEST,			1 )
DEF_INT( CONFIG_PRODUCTION,	2 )

@synthesize config = _config;
@dynamic url;
@dynamic testUrl;
@dynamic productionUrl;
@dynamic developmentUrl;

- (NSString *)url
{
	NSString * host = nil;

	if ( self.CONFIG_DEVELOPMENT == self.config )
	{
		host = self.developmentUrl;
	}
	else if ( self.CONFIG_TEST == self.config )
	{
		host = self.developmentUrl;
	}
	else
	{
		host = self.developmentUrl;
	}

	if ( NO == [host hasPrefix:@"http://"] && NO == [host hasPrefix:@"https://"] )
	{
		host = [@"http://" stringByAppendingString:host];
	}

	return host;
}

- (NSString *)developmentUrl
{
	return @"http://www.dddd.gg/index.php";
}

- (NSString *)testUrl
{
	return @"cp.x24hr.com:7080";
}

- (NSString *)productionUrl
{
	return @"cp.x24hr.com:7080";
}

@end

